var tmMember={};
$(document).ready(function(){
	$.ajaxSettings.async = false;
	$('#header').animate({'top':'0px'},400);
	$.getJSON(path+"/soccer/tmMemberAction!selectByTeamUser.action",{teamId: teamId}, function(data){
		tmMember=data.tmMember;
	});
	var headHtml=[];
	if("1"==tmMember.manageFlag){
		headHtml.push("榜单&nbsp&nbsp&nbsp&nbsp&nbsp<a id='newScoreListBtn' href='#' onclick='newScoreList()' class='button_right' style='background-color:#FF00FF;padding:8px 0;font-size:16px'>新榜单</a>");
	}else{
		headHtml.push("榜单");
	}
	$("#headTitle").html(headHtml.join(""));
	$.getJSON(path+"/soccer/tmScoreListAction!selectByTeam.action",{teamId: teamId}, function(data){
		  tmScoreList = data.tmScoreList;
	  	  var teamScoreListHtml=[];
	  	  $.each(tmScoreList,function(index,obj){
	  		  if(index%2==0){
	  			teamScoreListHtml.push("<div class='portfolio_item' style='background:#00CC00;margin:10px 2%;padding:10px 2%;'>");
	  		  }else{
	  			teamScoreListHtml.push("<div class='portfolio_item' style='background:#00CCFF;margin:10px 2%;padding:10px 2%;'>");
	  		  }
	  		  teamScoreListHtml.push("<h4>"+obj.listName+"</h4>");
	  		  teamScoreListHtml.push("<p>开始日期："+moment(obj.startDate,"YYYY-MM-DD").format("YYYY年MM月DD日")+"</p>");
	  		  teamScoreListHtml.push("<p>截止日期："+moment(obj.endDate,"YYYY-MM-DD").format("YYYY年MM月DD日")+"</p>");
	  		  teamScoreListHtml.push("<p>是否包含比赛数据："+GAME_DATA_FLAG_ARRAY[obj.gameDataFlag]+"</p>");
	  		  teamScoreListHtml.push("<p>是否包含违纪数据："+DISCIPLINE_FLAG_ARRAY[obj.disciplineFlag]+"</p>");
	  		  teamScoreListHtml.push("<p>备注："+obj.remark+"</p>");
	  		  teamScoreListHtml.push("<a href='#' onclick='gameData("+obj.rowId+")' class='button_11 orange'>查看榜单</a>");
	  		  if("1"==tmMember.manageFlag){
	  			teamScoreListHtml.push("<a href='#' onclick='modify("+obj.rowId+")' class='button_11 blue'>修改</a>");
	  		  }
	  		  teamScoreListHtml.push("</div>");
	  	   });
	  	   $("#teamScoreList").html(teamScoreListHtml.join(""));  
	  		  //alert(data);
	});
});
function goBack(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamMain.jsp?teamId="+teamId+"&timestamp="+timestamp;
}
function modify(tmScoreListId){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamScoreListEdit.jsp?teamId="+teamId+"&tmScoreListId="+tmScoreListId+"&timestamp="+timestamp;
}
function gameData(rowId){
//	var timestamp = (new Date()).valueOf();
//	window.location.href=path+"/soccer/teamGameDataSetCond.jsp?tmScoreListId="+teamId+"&timestamp="+timestamp;
	tmScoreListId = rowId;
	backURL="/soccer/teamScoreList.jsp";
	sessionStorage.setItem("teamGameDataSet-backURL", "/soccer/teamScoreList.jsp");
	viewTechScore();
}
function newScoreList(){
	var timestamp = (new Date()).valueOf();
	window.location.href=path+"/soccer/teamScoreListEdit.jsp?teamId="+teamId+"&timestamp="+timestamp;
}
